package com.wh.custom.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wh.custom.pojo.CustomSalesmancustom;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
* 后端Service接口；
*/
@Mapper
@Repository
public interface CustomSalesmancustomMapper extends BaseMapper<CustomSalesmancustom> {

    /**
     * 分页：查询当前页数据
     * @param page 分页参数
     * @param queryWrapper 查询条件
     * @return
     */
    List<CustomSalesmancustom> findByPage(@Param("page") IPage<CustomSalesmancustom> page,@Param("ew") QueryWrapper<CustomSalesmancustom> queryWrapper);

    void allocation(Long id, Long salesmanId);

    //根据类型查询
    //@Select("SELECT id FROM t_custom_customertype WHERE customer_type LIKE CONCAT('%', #{keyword}, '%')")
    Long selectTypeIdByTypeName(@Param("keyword") String keyword);

    //根据来源查询
    // @Select("SELECT id FROM t_custom_customersource WHERE customer_source LIKE CONCAT('%', #{keyword}, '%')")
    Long selectTypeIdBySourceName(@Param("keyword") String keyword);

    //根据标签查询
    //@Select("SELECT id FROM t_custom_customerlabel WHERE customer_label LIKE CONCAT('%', #{keyword}, '%')")
    Long selectTypeIdByLabelName(@Param("keyword") String keyword);
}
